package com.yingdong.message;

import java.util.Collection;
import java.util.List;

import com.yingdong.db.Userpet;
import com.yingdong.opcode.ServerOpcode;
import com.yingdong.sceneserver.inner.message.SendBaseMessage;

public class PetMessage extends SendBaseMessage {

	public PetMessage(Userpet userpet) {
		super(ServerOpcode.PET);
		writeByte(1);
		writeInt(userpet.getPos());
		writeInt(userpet.getEntId());
		writeString(userpet.getName());
		writeInt(userpet.getLevel());
		writeByte(userpet.getStage());
		writeInt(userpet.getHealth());
		writeInt(userpet.getMood());
		writeInt(userpet.getHunger());
		writeInt(userpet.getThirsty());
		writeInt(userpet.getClean());
		writeInt(userpet.getTired());
		writeInt(userpet.getClose());
		writeInt(userpet.getStrength());
		writeInt(userpet.getVitality());
		writeInt(userpet.getEndurance());
		writeInt(userpet.getIntelligence());
		writeInt(userpet.getCharm());
		writeInt(userpet.getAffinity());
	}

	public PetMessage(Collection<Userpet> list) {
		super(ServerOpcode.PET);
		writeByte(list.size());
		for (Userpet userpet : list) {
			writeInt(userpet.getPos());
			writeInt(userpet.getEntId());
			writeString(userpet.getName());
			writeInt(userpet.getLevel());
			writeByte(userpet.getStage());
			writeInt(userpet.getHealth());
			writeInt(userpet.getMood());
			writeInt(userpet.getHunger());
			writeInt(userpet.getThirsty());
			writeInt(userpet.getClean());
			writeInt(userpet.getTired());
			writeInt(userpet.getClose());
			writeInt(userpet.getStrength());
			writeInt(userpet.getVitality());
			writeInt(userpet.getEndurance());
			writeInt(userpet.getIntelligence());
			writeInt(userpet.getCharm());
			writeInt(userpet.getAffinity());
		}
	}
}
